HAL COMP types migration

This section provides information about the HAL COMP types migration .

HAL COMP enumeration migration

HAL COMP callbacks ID type definition

HAL1

HAL2 Related concept

typedef enum
{
    HAL_COMP_MSPDEINIT_CB_ID,
    HAL_COMP_MSPINIT_CB_ID,
    HAL_COMP_TRIGGER_CB_ID,
} HAL_COMP_CallbackIDTypeDef;

Removed .

Note

The callback registration in HAL2 is handled by specific functions for each COMP event.

COMP_HandleTypeDef comp_handle;

HAL_COMP_RegisterCallback(&comp_handle,
                           HAL_COMP_TRIGGER_CB_ID,
                           &User_HAL_COMP_TriggerCallback)
hal_comp_handle_t comp_handle

HAL_COMP_RegisterOutputTriggerCallback(&comp_handle , &HAL_COMP_OutputTriggerCallback)

Related concept: Individual callback registration APIs replace global register and unregister functions

COMP_HandleTypeDef comp_handle;

HAL_COMP_RegisterCallback(&comp_handle,
                          HAL_COMP_MSPDEINIT_CB_ID,
                          &User_HAL_COMP_TriggerCallback)
Msp Dinit callback Removed

Related concept:

COMP_HandleTypeDef comp_handle;

HAL_COMP_RegisterCallback(&comp_handle,
                          HAL_COMP_MSPINIT_CB_ID,
                          &User_HAL_COMP_TriggerCallback)
Msp Init callback Removed

Related concept:

COMP_HandleTypeDef comp_handle;

HAL_COMP_UnRegisterCallback(&comp_handle,
                           HAL_COMP_TRIGGER_CB_ID)
hal_comp_handle_t comp_handle

HAL_COMP_RegisterOutputTriggerCallback(&comp_handle, &HAL_COMP_OutputTriggerCallback)

Related concept: Individual callback registration APIs replace global register and unregister functions

The update from HAL1 to HAL2 involves a significant change in the way callback functions are registered for COMP events.


HAL COMP state type definition

HAL1

HAL2

typedef enum
{
  HAL_COMP_STATE_RESET
  HAL_COMP_STATE_RESET_LOCKED
  HAL_COMP_STATE_READY
  HAL_COMP_STATE_READY_LOCKED
  HAL_COMP_STATE_BUSY
  HAL_COMP_STATE_BUSY_LOCKED
} HAL_COMP_StateTypeDef;
typedef enum
{
  HAL_COMP_STATE_RESET
  HAL_COMP_STATE_INIT
  HAL_COMP_STATE_IDLE
  HAL_COMP_STATE_ACTIVE
  HAL_COMP_STATE_LINKED
  #if defined(COMP_WINDOW_MODE_SUPPORT)
  #if defined(USE_HAL_COMP_WINDOW_MODE) && (USE_HAL_COMP_WINDOW_MODE == 1)
  HAL_COMP_STATE_WINDOW_IDLE
  HAL_COMP_STATE_WINDOW_ACTIVE
  #endif /* USE_HAL_COMP_WINDOW_MODE */
  #endif /* COMP_WINDOW_MODE_SUPPORT */
} hal_comp_state_t;
Related concepts:

HAL COMP structure migration

HAL COMP callback type definition

HAL1

HAL2

pCOMP_CallbackTypeDef

hal_comp_cb_t

Related concept: Replaced TypeDef suffix with _t in type names


HAL COMP handle type definition

HAL1

HAL2

COMP_HandleTypeDef

hal_comp_handle_t

Related concept: Replaced TypeDef suffix with _t in type names


HAL COMP initialization type definition

HAL1

HAL2

COMP_InitTypeDef

hal_comp_config_t

typedef struct
{
  uint32_t Mode;

  uint32_t InputPlus;

  uint32_t InputMinus;

  uint32_t Hysteresis;

  uint32_t OutputPol;

  uint32_t BlankingSrce;







  uint32_t WindowOutput;

  uint32_t WindowMode;

  uint32_t TriggerMode;

} COMP_InitTypeDef;
typedef struct
{
  hal_comp_power_mode_t        power_mode;

  hal_comp_input_plus_t        input_plus;

  hal_comp_input_minus_t       input_minus;

  hal_comp_input_hysteresis_t  input_hysteresis;

  hal_comp_output_polarity_t   output_polarity;

  hal_comp_output_trigger_t    output_trigger;

} hal_comp_config_t;



typedef struct
{
  hal_comp_input_plus_t                 input;
  hal_comp_input_minus_t                upper_threshold;
  hal_comp_input_minus_t                lower_threshold;
  hal_comp_power_mode_t                 power_mode;
  hal_comp_input_hysteresis_t           input_hysteresis;
  hal_comp_output_polarity_t            output_polarity;
  hal_comp_output_trigger_t             output_trigger;
  hal_comp_window_output_mode_t         window_output_mode;
} hal_comp_window_config_t;

Related concept: Replaced TypeDef suffix with _t in type names